var launcher = document.querySelector('.launcher');
console.log(launcher);
var sending = function (event) {
    var chat = document.querySelector('.chat');
    console.log(chat.value);
    var information = chat.value;
    if (information === '') {
        alert('请输入内容')
    } else {
        chat.value = ''
        var commentBlock = document.querySelector('.commentBlock');
        var newCommentBlock = commentBlock.cloneNode(true);
        var comment = newCommentBlock.querySelector('.comment');
        comment.innerText = information;
        var article = document.querySelector('article');
        var nav = document.querySelector('.nav')
        var userImage = nav.querySelector('img');
        var newUserImage = newCommentBlock.querySelector('img');
        console.log(userImage.src);
        console.log(newUserImage.src);
        newUserImage.src = userImage.src;
        article.appendChild(newCommentBlock);
        event.stopPropagation();
    }

}
launcher.addEventListener('click', sending, true);
var control = document.getElementsByClassName('console')[0];
var select = document.getElementsByClassName('select')[0];
console.log(select, control);
var selectLi = select.querySelectorAll('li');
console.log(selectLi);
var change = function (event) {
    for (var i = 0; i < selectLi.length; i++) {
        selectLi[i].style.border = "solid 1px rgb(228, 189, 117)"
        selectLi[i].style.borderTop = "1px solid transparent"
    }
    select.style.height = '192px'
    event.stopPropagation();
}
control.addEventListener('click', function () {
    console.log('456');
})
control.addEventListener('mouseover', change, true);
function disapear() {
    for (var i = 0; i < selectLi.length; i++) {
        selectLi[i].style.border = 'solid 1px transparent'
    }
    select.style.height = 0;
}
control.addEventListener('mouseleave', disapear)

for (i = 0; i < selectLi.length; i++) {
    selectLi[i].addEventListener('mouseenter', change)
}
for (i = 0; i < selectLi.length; i++) {
    selectLi[i].addEventListener('mouseleave', disapear)
}
// for(i = 0;i < selectLi.length;i++){
//     selectLi[i].addEventListener('mouseleave',function(){
//         var event = control.
//         control.dispatchEvent('mouseleave')
//     })
// }